<?php
/* KAP event Manager, runclass

file version 2005-01-13 15:54:56
*/

/*----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------*/
class kap_eventManager extends kap_core_component {
/*----------------------------------------------------------------------------------------------------
																														proprietes
----------------------------------------------------------------------------------------------------*/
	var $default_parameters=array(
		'path' => 'events/'
	);
/*----------------------------------------------------------------------------------------------------
																												methodes publiques
----------------------------------------------------------------------------------------------------*/
	function runEvent($name,$params=array()) {
		//$this->C->needClass('runclass_event_model');	                         	
		// inclusion
		$dir=$this->parameters['path'];
		include_once($dir.$name.".event.php");
		if (!class_exists($name)) {
			trigger_error("kap_eventManager: event class $name is not defined",E_USER_WARNING);
			return false;
		}
		$event=& new $name($this->C);
		$retour=$event->run($params);
		$this->C->log("eventManager: ran event $name, parameters : ".join(', ',array_keys($params)));
		return $retour;
		//$this->calledEvents[]=$name;
		//echo affvar($this->controller->nextEvents);
	}
/*----------------------------------------------------------------------------------------------------
																												methodes privees
----------------------------------------------------------------------------------------------------*/
}

class runclass_event_model {
/*----------------------------------------------------------------------------------------------------
																														proprietes
----------------------------------------------------------------------------------------------------*/
	var $param=array();
/*----------------------------------------------------------------------------------------------------
																														constructeur
----------------------------------------------------------------------------------------------------*/
	function runclass_event_model (& $controller) {
		$this->controller=& $controller;
		$this->C=& $controller;
		$class=get_class($this);
		//$this->C->log("class $class instanciated / class $class instanciee");
	}
}
?>
